package bytestream;

import java.io.*;

public class Copy {
    public static void main(String[] args) {
        InputStream inputStream=null;
        OutputStream outputStream=null;
        {
            try {
                //创建文件读取对象
                inputStream = new FileInputStream("D:/h.ppt");
                //创建写入对象
                outputStream=new FileOutputStream("E:/xfmovie/h.ppt");
                //执行读取写入动作
                byte[] bytes=new byte[1024];
                int n=-1;
                while ((n=inputStream.read(bytes))!=-1) {
                    outputStream.write(bytes, 0, n);
                }


            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }finally {
                if (outputStream!=null) {
                    try {
                        outputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                if (inputStream!=null) {
                    try {
                        inputStream.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }


}
